<?php
declare (strict_types = 1);

namespace app\api\service;

class StatusCode
{
    const SUCCESS = 200;
    const CREATED = 201;
    const PARAM_ERROR = 400;
    const UNAUTHORIZED = 401;
    const FORBIDDEN = 403;
    const NOTFOUND = 404;
    const TIMEOUT = 408;
    const SERVER_ERROR = 500;

    public static $message = [
        '200' => '请求成功',
        '201' => '创建成功',
        '400' => '参数错误',
        '401' => '没有权限访问',
        '403' => '服务器拒绝请求',
        '404' => '请求数据为空',
        '408' => '请求超时',
        '500' => '服务器内部错误'
    ];

    public static function getMessage($code)
    {
        return self::$message[$code] ?? '超出范围';
    }

}